package org.wmq.shopmanager.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wmq.commonutil.result.Result;
import org.wmq.shopmanager.service.CategoryService;
import org.wmq.shopmodel.Entity.product.Category;

import java.util.List;

@RestController
@RequestMapping("/admin/product/category")
@RequiredArgsConstructor
public class CategoryController {
    private final CategoryService categoryService;

    @GetMapping("getCategoryListByParentId/{parentId}")
    public Result<List<Category>> getCategoryListByParentId(@PathVariable Long parentId){
        return Result.success(this.categoryService.getListByParentId(parentId));
    }
}
